<div id="header-area">
    <div id="header" style="top: 0px;">

        <!-- Begin top bar -->
        <div id="top-bar">
            <div id="top-bar-content">

                <!-- Begin dropdown links -->
                <div class="dropdown-links">
                    <ul>                        

                        <!-- Begin my account links (My Menu) -->
                        <li id="top-links">
                            <div id="top-links-switcher">
                                <span class="top-links-selected">My Menu</span>
                                <div id="top-links-options" style="display: none;">
                                    <div class="arrow-up"></div>
                                    <div id="top-links-options-inner">
                                        <ul>
                                            <li><a class="account" href="#">Tài khoản của tôi</a></li>
                                            <li><a class="wishlist" href="#">Sản phẫm yêu thích</a></li>
                                            <li><a class="shopping-cart" href="#">Giỏ hàng</a></li>
                                            <li><a class="checkout" href="#">Thanh toán</a></li>
                                        </ul>
                                    </div>
                                </div>
                            </div> 
                        </li>              

                    </ul>
                </div>
                <!-- End dropdown links -->
                
                <?php 
                    $so_sp_gio_hang = 0;
                    if(isset($_SESSION['daySoLuong'])){
                            
                            $tong_so_luong = $_SESSION['daySoLuong'];
                            foreach($tong_so_luong as $sl)
                            {
                                    $so_sp_gio_hang+=$sl;
                            }
                    }
                ?>
                <div id="cart">
                    <?php if (count($_SESSION['dayMaSP']) <= 0) { ?>
                        <div class="heading">
                        <h4><a><span id="cart-total">Bạn chưa mua sản phẩm nào !</span></a></h4>
                    </div>
                        <?php } else {
                            $tongsoluong = array_sum($_SESSION['dayMaSP']);
                         ?>
                            <div class="heading">
                        <h4><a><span id="cart-total"><?php echo $so_sp_gio_hang; ?> sản phẫm(s) - <?php echo number_format($_SESSION['tong_tien']); ?> VNĐ</span></a></h4>
                    </div>
                          <?php  }     ?>
                    
                    <?php 
                    if (isset($_SESSION['daySoLuong'])){
                        reset($_SESSION['daySoLuong']);
                        reset($_SESSION['dayMaSP']);
                        reset($_SESSION['dayTenSP']);
                        reset($_SESSION['dayMoTa']);
                        reset($_SESSION['dayDonGia']);
                        reset($_SESSION['dayUrlHinh']);
                        reset($_SESSION['daySize']);
                        reset($_SESSION['dayMau']);
                        while (key($_SESSION['daySoLuong']) != null) {
                            $idSP = key($_SESSION['daySoLuong']);
                            $mota = current($_SESSION['dayMoTa']);
                            $tensp = current($_SESSION['dayTenSP']);
                            $soluong = current($_SESSION['daySoLuong']);
                            $dongia = current($_SESSION['dayDonGia']);
                            $urlhinh = current($_SESSION['dayUrlHinh']);                           
                            if ($soluong > 0) {
                    ?>    
                    <div class="content">
                        <div class="arrow-up-back"></div>
                        <div class="arrow-up"></div>
                        <div class="mini-cart-info">
                            <table>
                                <tbody><tr>
                                        <td class="image">            
                                            <a href="product/product&product_id=47">
                                                <img width="47" height="47" src="<?php echo $urlhinh; ?>" title="">
                                            </a>
                                        </td>
                                        <td class="name"><a href="product/product&product_id=47"><?php echo $tensp; ?></a>
                                            
                                        </td>
                                        <td class="quantity">x&nbsp;<?php echo $soluong; ?></td>
                                        <td class="total"><?php echo number_format($dongia); ?> VNĐ</td>
                                        <td class="remove"><img src="static/remove-small.png" alt="Remove" onclick="$( & #39; #cart & #39; ).load( & #39; index.php?route = module / cart & amp; remove = 47:YToxOntpOjIyNTtzOjEwOiIyMDExLTA0LTIyIjt9: #cart & gt; * & #39; );" oldtitle="Remove" title=""></td>
                                    </tr>
                                </tbody></table>
                        </div>
                        <div class="mini-cart-total">
                            <table>
                                <tbody>
                                    <tr>
                                        <td align="right"><b>Tổng đơn hàng:</b></td>
                                        <td align="right"><?php echo number_format($_SESSION['tong_tien']); ?> VNĐ</td>
                                    </tr>
                                </tbody></table>
                        </div>

                        <!-- Begin mini cart buttons -->
                        <div class="checkout">
                            <a class="button" id="close_cart">Đóng</a> 
                            <a href="gio-hang.html" class="button">Giỏ hàng</a>
                            <a href="thanh-toan.html" id="checkout-button" class="button">Thanh toán</a>
                        </div>
                        <!-- End mini cart buttons -->

                    </div>
                      <?php
                            }
                                next($_SESSION['daySoLuong']);
                                next($_SESSION['dayDonGia']);
                                next($_SESSION['dayMaSP']);
                                next($_SESSION['dayUrlHinh']);
                                next($_SESSION['dayMau']);
                                next($_SESSION['daySize']);
                            ?>
                    <?php } } ?>
                </div>

                <!-- "Close" button mobile devices fix -->
                <script type="text/javascript">
                    $(function() {
                        $('#close_cart').live('click', function(event) {
                            event.preventDefault();
                            $('#cart').removeClass('active');
                        });
                    });
                </script>

                <!-- Begin search -->
                <div id="search">
                    <div class="button-search"></div>
                    <input type="text" name="Tìm kiếm" placeholder="Tìm kiếm" value="">
                </div>
                <!-- End search -->

                <!-- Begin welcome -->
                <div id="welcome">
                    Xin chào, bạn có thể <a href="dang-nhap.html">đăng nhập</a> or <a href="dang-ky.html">tạo tài khoản</a>.                      </div>
                <!-- End welcome -->

            </div>
        </div>
        <!-- End top bar -->

        <div id="header-content">

            <!-- Begin logo -->
            <div id="logo"><a href="index.php"><img src="static/pn-logo.png" alt="Zipp"></a></div>

            <!-- End logo -->

            <!-- Begin search mobile -->
            <div id="search-mobile">
                <div class="button-search-mobile"></div>
                <input type="text" name="search" placeholder="Search" value="">
            </div>
            <!-- End search mobile -->

            <!-- Begin menu -->
            <div id="menu" style="">
                <ul>
                    <?php
                        $tl=$tc->getTheLoai();
                        while ($row_tl=  mysql_fetch_assoc($tl)){
                    ?>
                    <li><a href="#"><?php echo $row_tl['TenTL']; ?><span class="arrow-down"></span><span class="arrow-up-back"></span><span class="arrow-up"></span></a>
                        <div style="">
                            <div class="sub-menu-content">
                                <ul>
                                    <?php 
                                        $idTL=$row_tl['idTL'];
                                        $loaisp=$tc->getLoaiSPTheoTheLoai($idTL);
                                        while ($row_loai=  mysql_fetch_assoc($loaisp)){
                                    ?>
                                    <li idTL="<?php echo $row_loai['idTL']; ?>"><a href="danhmuc/<?php echo $row_loai['ten_kd'].'-'.$row_loai['loai_id']; ?>.html"><?php echo $row_loai['loai']; ?> </a></li>
                                    <?php } ?>
                                    
                                </ul>
                            </div>
                        </div>
                    </li>
                    
                        <?php } ?>
                    
                    <li><a href="#">Góc chia sẽ<span class="arrow-down"></span><span class="arrow-up-back"></span><span class="arrow-up"></span></a>
                        <div style="">
                            <div class="sub-menu-content">
                                <ul>
                                    <?php                                        
                                        $loaitin=$tc->getLoaiTin();
                                        while ($row_loaitin=  mysql_fetch_assoc($loaitin)){
                                    ?>
                                    <li idTL="<?php echo $row_loaitin['idLT']; ?>"><a href='danhmuctin/<?php echo $row_loaitin["TenLT_KhongDau"]; ?>-<?php echo $row_loaitin['idLT'].".html"; ?>'><?php echo $row_loaitin['TenLT']; ?> </a></li>
                                    <?php } ?>
                                    
                                </ul>
                            </div>
                        </div>
                    </li>                   
                    

                </ul>
            </div>
            <!-- End menu -->

            <!-- Begin menu-mobile -->
            <div id="menu-mobile">
                <div id="menu-mobile-link"><img src="static/mobile-menu.png" alt="Menu"></div>
                <div id="menu-mobile-nav">
                    <ul>
                     <?php
                        $tl=$tc->getTheLoai();
                        while ($row_tl=  mysql_fetch_assoc($tl)){
                    ?>
                        <li class="cat-mobile"><a href="#"><?php echo $row_tl['TenTL']; ?></a>
                            <!-- Begin sub categories -->
                            <div class="sub-cat-mobile">
                                <ul>
                                    <?php 
                                        $idTL=$row_tl['idTL'];
                                        $loaisp=$tc->getLoaiSPTheoTheLoai($idTL);
                                        while ($row_loai=  mysql_fetch_assoc($loaisp)){
                                    ?>
                                    <li idTL="<?php echo $row_loai['idTL']; ?>"><a href="danhmuc/<?php echo $row_loai['ten_kd'].'-'.$row_loai['loai_id']; ?>.html"><?php echo $row_loai['loai']; ?></a></li>
                                    <?php } ?>
                                </ul>
                            </div>
                            <!-- End sub categories -->
                        </li>
                                      
                       <?php } ?>
                        <li><a href="#">Góc chia sẽ<span class="arrow-down"></span><span class="arrow-up-back"></span><span class="arrow-up"></span></a>
                        <div style="">
                            <div class="sub-menu-content">
                                <ul>
                                    <?php                                        
                                        $loaitin=$tc->getLoaiTin();
                                        while ($row_loaitin=  mysql_fetch_assoc($loaitin)){
                                    ?>
                                    <li idTL="<?php echo $row_loaitin['idLT']; ?>"><a href="danhmuctin/<?php echo $row_loaitin["TenLT_KhongDau"]; ?>-<?php echo $row_loaitin['idLT'].".html"; ?>"><?php echo $row_loaitin['TenLT']; ?> </a></li>
                                    <?php } ?>
                                    
                                </ul>
                            </div>
                        </div>
                    </li>
                    </ul>
                </div>
            </div>
            <!-- End menu-mobile -->

            <!-- Begin welcome mobile -->
            <div id="welcome-mobile">
                Xin chào, bạn có thể <a href="dang-nhap.html">đăng nhập</a> or <a href="dang-ky.html">tạo tài khoản</a>.              </div>
            <!-- End welcome mobile -->

            <!-- Begin links mobile -->
            <div class="links-mobile">
                <a href="index.php"><span class="text-home">Trang chủ</span></a>
                <a href="account/wishlist" id="wishlist-total-mobile">Wish List (0)</a>
                <a href="account/account"><span class="text-account">Tài khoản</span></a>
                <a href="checkout/cart"><span class="text-shopping-cart">Giỏ hàng</span></a>
                <a href="checkout/checkout"><span class="text-checkout">Thanh toán</span></a>
             
            </div>
            <!-- End links mobile -->
            
        </div>
    </div>
</div>